<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<#include "/common/meta.ftl"/>
<#include "/common/loginCss.ftl"/>
<script>
	$(function(){
		$(document).keyup(function(event){
		  if(event.keyCode ==13){
		    $("#loginBtn").trigger("click");
		  }
		});
	});
	function loginFun(){
		var userLoginName = $("#userLoginName").val();
		var userPwd = $("#userPwd").val();
		var captcha = $("#captcha").val();
		if(userLoginName==""){
			$("#userLoginName").focus();
			var msg = new top.$.zui.Messager('提示消息：请先输入用户账号！', {
		                	type : 'warning',
		                	fade : true,
		                	icon : 'warning-sign',
		                	time : 2000,
		                	scale : true
	    	});
			msg.show();
		}else{
			$.post('./login', {
					userLoginName : userLoginName,
					userPwd : userPwd,
					captcha : captcha
			}, function(result) {
				if(result.success){
					top.location.replace('index');
				}else{
					var msg = new top.$.zui.Messager('提示消息：' + result.msg, {
		                	type : 'warning',
		                	fade : true,
		                	icon : 'warning-sign',
		                	time : 2000,
		                	scale : true
			    	});
					msg.show();
					$("#userPwd").val('');
					$("#userPwd").focus();
				}
			}, 'json');
		}
	}
</script>
</head>
<body>
	<div class="container login_index">
		<h2 class="form-signin-heading">${_sysTitle!''}</h2>
		<form class="form-signin form-horizontal" role="form" method="post" action="">
			<div class="input-group" style="margin-bottom:10px;">
  				<span class="input-group-addon" style="">
  					<i class="icon icon-user" style="display:block;width:15px;"></i>
  				</span>
  				<input type="text" id="userLoginName" name="userLoginName" value="" class="form-control" placeholder="账号" autofocus></input>
			</div>
			<div class="input-group" style="margin-bottom:10px;">
  				<span class="input-group-addon" >
  					<i class="icon icon-key" style="display:block;width:15px;"></i>
  				</span>
  				<input type="password" id="userPwd" name="userPwd" value="" class="form-control" placeholder="密码"></input>
			</div>
			<#if (needVC!'')=='1'>
			<div class="input-group" style="">
				<span class="input-group-addon" >
  					<i class="icon icon-unlock-alt" style="display:block;width:15px;"></i>
  				</span>
				<input class="form-control " type="text" id="captcha" name="captcha" value="" placeholder="请输入验证码"/>
				<span class="input-group-addon" style="padding:0px 10px;border-left:0px;">
				<img id="captcha" alt="验证码" src="${_b}/admin/captcha.jpg" style="vertical-align:middle;border-radius:4px;width:80px;cursor:pointer;">
				</span>
			</div>
			</#if>
			<button class="btn btn-lg btn-primary btn-block" id="loginBtn" type="button" onclick="loginFun();">立即登录</button>
			<div class="form-signin-link">&nbsp;
			</div>
		</form>
	</div>
<footer>
	<div class="container">
		<div class="powered_by">
			&copy; 2017 河北新禾科技有限公司
		</div>
	</div>
</footer>
</body>
</html>
